package com.hatricks.is.base.common;

import org.openjdk.jol.info.ClassLayout;

import java.util.HashMap;
import java.util.Map;

public class MemoryLayout {

    public static void main(String[] args) {
        Map<String, String> ml = new HashMap<>();
        ml.put("xx", "xx");
        ml.put("xxx", "xx");
        ml.put("xxxxx", "xx");
        // 查看对象内部信息
//        System.out.println(ClassLayout.parseInstance(ml).toPrintable());
//        System.out.println("==================");
//         查看对象引用信息
//        System.out.println(GraphLayout.parseInstance(ml).toPrintable());
//         查看对象总大小
//        System.out.println(GraphLayout.parseInstance(ml).totalSize());
        int i = 1;

        System.out.println(ClassLayout.parseInstance(i).toPrintable());
        System.out.println("--------------------------------");
        System.out.println(ClassLayout.parseInstance(ml).toPrintable());




    }
}
